#!/usr/bin/env python

import sys
import math

if __name__ == "__main__":
    if len(sys.argv) == 3:
        input_path = sys.argv[1]
        output_path = sys.argv[2]
    else:
        input_path = "input.txt"
        output_path = "output.txt"

    n = None
    A = []
    b = None
    with open(input_path, "r") as input_f:
        n = int(input_f.readline().strip())

        for i in range(n):
            row = map(float, input_f.readline().split())
            A.append(row)

        b = map(float, input_f.readline().split())

    x = None
    with open(output_path, "r") as output_f:
        x = map(float, output_f.readline().split())

    err = 0
    for i in range(n):
        lhs = 0
        for j in range(n):
            lhs += A[i][j] * x[j]
        r = b[i] - lhs
        err += r * r
    err = math.sqrt(err)

    print "%.8lf" % err

